<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>调整申请</title>
</head>
<script src="//unpkg.com/vue/dist/vue.js"></script>
<link rel="stylesheet"
	href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" />
<link rel="stylesheet"
	href="./resources/css/sweetalert2.css" />
<script src="//unpkg.com/element-ui/lib/index.js"></script>
<script src="./resources/js/jquery.min.js"></script>
<script src="./resources/js/sweetalert2.min.js"></script>
<body>
<div id="mainApp">
  <el-container style="padding-top:20px;">
	  <el-header style="heighe:10px;">
		  <el-row :gutter="24">
			<el-col :span="8" :xs="8" :sm="8" :md="8" :lg="8">
				<el-breadcrumb class="breadcrumb-inner">
					<el-breadcrumb-item><h2>调整申请</h2></el-breadcrumb-item>
				</el-breadcrumb>
			</el-col>
		  </el-row>
	  </el-header>
	  <el-main>
	  	  <el-card calss="box-card">
	  	  	<el-row :gutter="24">
		  		<el-col :span="8" :xs="8" :sm="8" :md="8" :lg="8">
		  			<span><h4>调整申请</h4></span>
		  		</el-col>
		  	</el-row>
		  </el-card>
		  <el-card>
		  	<el-row style="overflow-x:hidden;">
			     <el-table :data="tableData" style="width:980%;margin:15px auto">
				    <el-table-column prop="processInstanceId" label="流程实例ID" >
				    </el-table-column>
				    <el-table-column prop="userId" label="用户ID" >
				    </el-table-column>
				    <el-table-column prop="reason" label="原因" >
				    </el-table-column>
				    <el-table-column label="操作" >
				    	<template slot-scope="scope">
				    		 <el-button type="primary" @click="handelApp(scope.row)">调整申请</el-button>
				    	</template>
				    </el-table-column>
				  </el-table>
			  </el-row>
		  </el-card>
	  </el-main>
  </el-container>
  <el-dialog title="调整申请" :visible.sync="dialogFormVisible">
		  	<el-form>
			  <el-form-item label="申请信息">
			    <el-input v-model="appRow.reason" placeholder="申请信息"></el-input>
			  </el-form-item>
			  <el-form-item label="是否调整申请" >
			      <el-select v-model="approFlag" placeholder="请选择">
			        <el-option label="是" value="Y"></el-option>
			        <el-option label="否" value="N"></el-option>
			      </el-select>
			  </el-form-item>
			  <el-form-item>
			    <el-button type="primary" @click="complateChangeApply">调整申请</el-button>
			  </el-form-item>
			</el-form>
		  </el-card>
  </el-dialog>
</div>
</body>
<script>
new Vue({
		el:"#mainApp",
	    data:{
	    	tableData:[],
	    	appRow:{},
	    	dialogFormVisible:false,
	    	approFlag:"Y"
	    },
	    mounted:function(){
	    	this.queryChangeApproval();
	    },
	    methods: {
	      handelApp(row){
	    	  this.dialogFormVisible = true;
	    	  this.appRow = row;
	      },
	      queryChangeApproval(){
	    	  var _this = this;
			  $.get("appro/queryChangeApproval",{
			  }, function(data) {
				  _this.tableData = data
	    	  });
	      },
	      complateChangeApply(){
			  var _this = this;
			  console.log(_this.appRow);
			  $.post("appro/complateChangeApply/"+this.approFlag,_this.appRow, function(data) {
				  if(data.code=="1"){
					  swal("调整申请成功!");
					  this.dialogFormVisible = false;
				  }
				  console.log(data);
	    	  });
		  }
	    }
	  });
</script>
</html>